<?php 
include "db/db_connect.php";

function rss(){
echo "
<table width='135'>
        <tr>
          <td width='125' height='174'><iframe src='ler_rss.php' id='rss' width='100%' height='100%' frameborder='0' scrolling='no'></iframe></td>
        </tr>
      </table>
";

}



function logar()
{
echo"
<table width='137' height='101'  border='0' cellpadding='0' cellspacing='0' >
 <form action='efetua_login.php' method='post' name='frmlogin1' target='_top' id='frmlogin1'>
  <tr><td height='2'></td></tr>
    <tr bgcolor='#990000'>
      <td width='32%' height='23'>&nbsp;<span class='txt_simples_branco'>Login:</span></td>
      <td width='68%'><input name='txtlogin' type='text' id='txtlogin' OnBlur='JavaScript:ConcatenaLoginMail_direita();' size='12' class='form_simples' /></td>
    </tr>
    <tr bgcolor='#990000'>
      <td height='28'>&nbsp;<span class='txt_simples_branco'>Senha:</span></td>
      <td><input name='txtsenha' type='password' id='txtsenha' size='12' class='form_simples' /></td>
    </tr>
    <tr align='left' valign='bottom' bgcolor='#990000'>
      <td height='24' colspan='2' align='center' valign='middle' bgcolor='#990000'><input name='btnLogar' type='submit' id='btnLogar' value='Logar' class='form_simples_botao'/></td>
    </tr>
    <tr align='left' valign='bottom' bgcolor='#990000'>
      <td height='24' colspan='2' align='center' valign='middle' bgcolor='#990000'>
	  </td>
    </tr>
  </form>
</table>

";
}



function logado(){

echo"
<table width='137' height='26'  border='0' cellpadding='0' cellspacing='0'>
  <tr><td width='32%' height='2'></td></tr>
    <tr align='left' valign='bottom' bgcolor='#990000'>
      <td width='68%' height='24' colspan='2' align='center' valign='middle' bgcolor='#990000' class='txt_simples_branco'>
	  <div align='left'><b>&nbsp;Bem vindo</b></div><div align='center'>".$_SESSION["nome_usuario"]."</div></td>
    </tr>
</table>

";
}


function noticias(){

echo"
<table width='137' height='30'  border='0' cellpadding='0' cellspacing='0' >
  <tr><td width='31%' height='2'></td></tr>
    <tr align='left' valign='bottom' bgcolor='#990000'>
      <td height='21' colspan='2' align='left' valign='middle' bgcolor='#990000' class='menu_principal_titulo'>&nbsp;Noticias</td>
    </tr>
	";

$QrySql1 = mysql_query("select TITULO,ID,DATA_INI from noticias where status=1 order by id desc limit 7");									    
while($rowSql1=mysql_fetch_array($QrySql1))
{ 
	echo"
<tr align='left' valign='bottom' bgcolor='#996666'>
		  <td height='13' align='left' valign='top' class='txt_simples_branco_2'>&nbsp;".$rowSql1["DATA_INI"]."</td>
		  <td width='69%' height='13' align='center' valign='middle'></td>
		</tr>
		<tr align='left' valign='top' bgcolor='#996666'>
		  <td height='19' colspan='2' align='center' valign='middle' class='txt_simples_branco'>
		  <a href='index.php?idpag=85&idnews=".$rowSql1["ID"]."' target='_top'>
		  ".$rowSql1["TITULO"]."
		  </a>
		  </td>
		</tr>
	";

}
echo "</table>";
}


if (isset($_SESSION["id_permissao"]) && strpos(DEF_PERMISSAO_USER_INTRA,$_SESSION["id_permissao"]))
{
	logado();
}else{
	logar();
}


noticias();


?>
